<%--
  Created by IntelliJ IDEA.
  User: BHT
  Date: 2023/4/23
  Time: 10:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
    <title>订单统计</title>
</head>
<body>
<div id="container" style="height: 100%"></div>

<script type="text/javascript" src="<c:url value='/jquery/jquery-2.1.1.js'/>"></script>
<script type="text/javascript" src="https://fastly.jsdelivr.net/npm/echarts@5.4.2/dist/echarts.min.js"></script>
<script type="text/javascript">
    var dom = document.getElementById('container');
    var myChart = echarts.init(dom, null, {
        renderer: 'canvas',
        useDirtyRect: false
    });
    var app = {};
    var appdata=[];
    var value=[];

    var dataName=[];

    var option;
    var t_this=this;
    $.ajax({
        async:false,
        cache:false,
        url:"/book-ssm/admin/book/orderforgoods.do",
        // data:{pid:pid},
        type:"get",
        dataType:"json",
        success:function(arr) {
            console.log(arr);
            for (let i=0;i<arr.length;i++){
                console.log(arr[i]);
                t_this.dataName.push(arr[i]);
            }
        }
    });
    for (let i=0;i<dataName.length;i++){
        appdata.push(dataName[i].name.substring(5,10));
        console.log(dataName[i].name.substring(5,10));
        value.push(dataName[i].value);
        console.log(dataName[i].value)
    }

    option = {
        xAxis: {
            type: 'category',
            data:appdata
        },
        yAxis: {
            type: 'value'
        },
        series: [
            {
                data: value,
                type: 'line',
                smooth: true
            }
        ]
    };

    if (option && typeof option === 'object') {
        myChart.setOption(option);
    }

    window.addEventListener('resize', myChart.resize);
</script>
</body>
</html>
